package org.goodprinciples.oracolo.model;

import java.util.Objects;
import java.util.Set;
import org.goodprinciples.commons.bean.CodeDescriptionBean;

/**
 *
 * @author Francesco Conte
 */
public class Property extends OracoloBean<Property> {
    
    private Long id = null;
    private String name = null;
    private PropertyType type = null;
    private Domain domain = null;
    private Set<PropertyDescription> descriptions = null;
    
    public Property() {}

    public Set<PropertyDescription> getDescriptions() {
        return descriptions;
    }

    public void setDescriptions(Set<PropertyDescription> descriptions) {
        this.descriptions = descriptions;
    }

    public Domain getDomain() {
        return domain;
    }

    public void setDomain(Domain domain) {
        this.domain = domain;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public PropertyType getType() {
        return type;
    }

    public void setType(PropertyType type) {
        this.type = type;
    }

    public boolean equals(java.lang.Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Property other = (Property) obj;
        if (!Objects.equals(this.id, other.id)) {
            return false;
        }
        return true;
    }

    public int hashCode() {
        int hash = 7;
        hash = 89 * hash + Objects.hashCode(this.id);
        return hash;
    }

    public String toString() {
        return "Property{" + "id=" + id + ", name=" + name + ", type=" + type + ", domain=" + domain + ", descriptions=" + descriptions + '}';
    }
    
    public static enum PropertyType implements CodeDescriptionBean {
        
        KEY("K", "Key attribute"),
        ATTRIBUTE("A", "Simple attribute"),
        ;
        
        private String code = null;
        private String description = null;
        
        private PropertyType(String code, String description) {
            this.code = code;
            this.description = description;
        }

        @Override
        public String getCode() {
            return code;
        }

        @Override
        public String getDescription() {
            return description;
        }

        public String toString() {
            return "PropertyType{" + "code=" + code + ", description=" + description + '}';
        }
        
    }
    
}
